﻿using Microsoft.Xna.Framework;
using Rescue_of_the_Dwarvenzombies.SceneLayers;
using Rescue_of_the_Dwarvenzombies.SceneObjects.GameObjects;
using GameLibrary;

namespace Rescue_of_the_Dwarvenzombies.SceneObjects.GUIObjects
{
    public class ScoreBar : GameObject
    {
        private Game _game;
        private ISceneLayer _parentLayer;
        /// <summary>
        /// Initializes a new instance of the <see cref="ScoreBar"/> class.
        /// </summary>
        /// <param name="game">The game.</param>
        public ScoreBar(Game game)
        {
            _game = game;
            TextureName = null;
            TintColor = Color.Gold * 0.8f;
        }

        /// <summary>
        /// Updates the ScoreBar
        /// </summary>
        /// <param name="gameTime">The game time.</param>
        public override void Update(GameTime gameTime)
        {
            ICamera camera = (ICamera)_game.Services.GetService(typeof(ICamera));
            Position = new Vector2(camera.BoundingBox.Max.X - 300, camera.BoundingBox.Min.Y + 3);
        }

        /// <summary>
        /// Gets or sets the total score.
        /// </summary>
        /// <value>
        /// The total score.
        /// </value>
        public float TotalScore { get; set; }

        /// <summary>
        /// Returns a <see cref="System.String"/> that represents this instance.
        /// </summary>
        /// <returns>
        /// A <see cref="System.String"/> that represents this instance.
        /// </returns>
        public override string ToString()
        {
            return "Score: " + TotalScore;
        }
    }
}
